<?php
use_helper('I18N');
?>
<script type="text/javascript">
    $(function() {
        $("#btnSubmitPasswordForm").click(function(){
            $("#passwordForm").submit();
        });
        $("#passwordForm").validate({
            messages : {
                newPassword2: {
                    equalTo: "Please enter the same password as above"
                }
            },
            rules : {
                "oldPassword" : {
                    required : true,
                    minlength : 3
                },
                "newPassword" : {
                    required : true,
                    minlength : 3
                },
                "newPassword2" : {
                    required : true,
                    minlength : 3,
                    equalTo: "#newPassword"
                }
            },
            submitHandler: function(form) {
                waiting();
                form.submit();
            }
        });

        $("#securityPasswordForm").validate({
            messages : {
                newSecurityPassword2: {
                    equalTo: "Please enter the same password as above"
                }
            },
            rules : {
                "oldSecurityPassword" : {
                    required : true,
                    minlength : 3
                },
                "newSecurityPassword" : {
                    required : true,
                    minlength : 3
                },
                "newSecurityPassword2" : {
                    required : true,
                    minlength : 3,
                    equalTo: "#newSecurityPassword"
                }
            },
            submitHandler: function(form) {
                waiting();
                form.submit();
            }
        });
        $("#btnSecurityUpdate").click(function(){
            $("#securityPasswordForm").submit();
        });
    });
</script>
<div class="row">
    <div class="col-md-12">
        <h2 class="page-title"><?php echo __("Password Setting"); ?>
            <small></small>
        </h2>
    </div>
</div>

<div class="row">
    <div class="col-md-7">
        <section class="widget">
            <header>
                <h4>
                    <i class="icon-ok-sign"></i>
                    <?php echo __("Login Password"); ?>
                    <small></small>
                </h4>
            </header>
            <div class="body">
                <form action="/member/loginPassword"
                      id="passwordForm"
                      name="passwordForm"
                      method="post" class="form-horizontal" role="form">

                    <fieldset>
                        <legend class="section">
                        <?php echo __("Change Account login Password")?>
                        </legend>
                        <?php include_component('component', 'alert', array('param' => $sf_user->getAttribute(Globals::SESSION_DISTID, 0))) ?>

                        <div class="row">
                            <div class="col-sm-8">
                                <div class="control-group">
                                    <label class="control-label" for="oldPassword">
                                    <?php echo __("Old Login Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="oldPassword" id="oldPassword"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="newPassword">
                                    <?php echo __("New Login Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="newPassword" id="newPassword"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="newPassword2">
                                    <?php echo __("Re-enter Login Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="newPassword2" id="newPassword2"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                    <div class="form-actions">
                        <button type="button" id="btnSubmitPasswordForm" class="btn btn-info">
                            <i class="icon-ok bigger-110"></i>
                            <?php echo __("Submit");?>
                        </button>
                        <a href="/member/summary" class="btn btn-default"><?php echo __("Cancel");?></a>
                    </div>
                </form>
            </div>
        </section>
    </div>
</div>

<div class="row">
    <div class="col-md-7">
        <section class="widget">
            <header>
                <h4>
                    <i class="icon-ok-sign"></i>
                    <?php echo __("Security Password"); ?>
                    <small></small>
                </h4>
            </header>
            <div class="body">
                <form action="/member/transactionPassword"
                      id="securityPasswordForm"
                      name="securityPasswordForm"
                      method="post" class="form-horizontal" role="form">

                    <fieldset>
                        <legend class="section">
                        <?php echo __("Change Security Password")?>
                        </legend>

                        <div class="row">
                            <div class="col-sm-8">
                                <div class="control-group">
                                    <label class="control-label" for="oldSecurityPassword">
                                    <?php echo __("Old Security Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="oldSecurityPassword" id="oldSecurityPassword"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="newSecurityPassword">
                                    <?php echo __("New Security Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="newSecurityPassword" id="newSecurityPassword"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="newSecurityPassword2">
                                    <?php echo __("Re-enter Security Password")?>
                                    </label>

                                    <div class="controls form-group">
                                        <input type="password" name="newSecurityPassword2" id="newSecurityPassword2"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                    <div class="form-actions">
                        <button type="button" id="btnSecurityUpdate" class="btn btn-info">
                            <i class="icon-ok bigger-110"></i>
                            <?php echo __("Submit");?>
                        </button>
                        <a href="/member/summary" class="btn btn-default"><?php echo __("Cancel");?></a>
                    </div>
                </form>
            </div>
        </section>
    </div>
</div>